#include<stdio.h>
#include<stdlib.h>  
struct node 
{ 
	int no; 
	struct node * next; 
};

int main( ) 
{ 
	int n,k,m;
	scanf("%d,%d,%d",&n,&k,&m);
	if(n<1||k<1||m<1)
		printf("n,m,k must bigger than 0.\n");
	
	else if(k>n)
		printf("k should not bigger than n.\n");
	
	else{
		int i;  
		struct node *head, *p, *q; 
		head = (struct node *)malloc(sizeof(struct node)); 
		head->no   = -1; 
		head->next = head; 
		
		for ( i=n; i>0; i-- )                        /* 生成循环链表 */ 
		{ 
			p = (struct node *)malloc(sizeof(struct node)); 
			p->next = head->next;  
			p->no   = i;  
			head->next = p; 
		} 
		
		while ( p->next != head )               /* 循环链跳过表头结点 */ 
		p = p->next; 
		p->next = head->next; 
		/* p 指向 30 */ 
		
		for ( i=k-1; i>0; i-- )  
		{
			p = p->next; 
		}
		
		for ( i=1; i<=n; i++ ) 
			{
				for ( int j=1 ; j<m ; j++ )  
					p = p->next; 
				q = p->next; 
				p->next = q->next;          /* 循环链表跳过要出列的结点 */ 
				printf("%d", q->no);    /* 输出 q 结点的编号 */ 
				free(q);  /* 释放 q 结点 */ 
				if(i%10==0||i==n)printf("\n");
				else printf(" ");
			} 
	}
}